package com.ruoyi.teaching.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.teaching.mapper.TeachingStudentApplyMapper;
import com.ruoyi.teaching.domain.TeachingStudentApply;
import com.ruoyi.teaching.service.ITeachingStudentApplyService;
import com.ruoyi.common.core.text.Convert;

/**
 * 学生报课Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-10-17
 */
@Service
public class TeachingStudentApplyServiceImpl implements ITeachingStudentApplyService 
{
    @Autowired
    private TeachingStudentApplyMapper teachingStudentApplyMapper;

    /**
     * 查询学生报课
     * 
     * @param studentId 学生报课主键
     * @return 学生报课
     */
    @Override
    public TeachingStudentApply selectTeachingStudentApplyByStudentId(Long studentId)
    {
        return teachingStudentApplyMapper.selectTeachingStudentApplyByStudentId(studentId);
    }

    /**
     * 查询学生报课
     * @param applyId 学生报课Id
     * @return 学生报课
     */
    public TeachingStudentApply selectTeachingStudentApplyByApplyId(Long applyId)
    {
        return teachingStudentApplyMapper.selectTeachingStudentApplyByApplyId(applyId);
    }

    /**
     * 查询学生报课
     *
     * @param schoolId 学生报课Id
     * @param studentId 学生报课主键
     * @return 学生报课
     */
    @Override
    public TeachingStudentApply selectTeachingStudentApplyByStudentIdAndSchoolId(Long studentId,Long schoolId)
    {
        return teachingStudentApplyMapper.selectTeachingStudentApplyByStudentIdAndSchoolId(studentId,schoolId);
    }

    /**
     * 查询学生报课列表
     * 
     * @param teachingStudentApply 学生报课
     * @return 学生报课
     */
    @Override
    public List<TeachingStudentApply> selectTeachingStudentApplyList(TeachingStudentApply teachingStudentApply)
    {
        return teachingStudentApplyMapper.selectTeachingStudentApplyList(teachingStudentApply);
    }

    /**
     * 新增学生报课
     * 
     * @param teachingStudentApply 学生报课
     * @return 结果
     */
    @Override
    public int insertTeachingStudentApply(TeachingStudentApply teachingStudentApply)
    {
        teachingStudentApply.setCreateTime(DateUtils.getNowDate());
        return teachingStudentApplyMapper.insertTeachingStudentApply(teachingStudentApply);
    }

    /**
     * 修改学生报课
     * 
     * @param teachingStudentApply 学生报课
     * @return 结果
     */
    @Override
    public int updateTeachingStudentApply(TeachingStudentApply teachingStudentApply)
    {
        teachingStudentApply.setUpdateTime(DateUtils.getNowDate());
        return teachingStudentApplyMapper.updateTeachingStudentApply(teachingStudentApply);
    }

    /**
     * 批量删除学生报课
     * 
     * @param studentIds 需要删除的学生报课主键
     * @return 结果
     */
    @Override
    public int deleteTeachingStudentApplyByStudentIds(String studentIds)
    {
        return teachingStudentApplyMapper.deleteTeachingStudentApplyByStudentIds(Convert.toStrArray(studentIds));
    }

    /**
     * 删除学生报课信息
     * 
     * @param studentId 学生报课主键
     * @return 结果
     */
    @Override
    public int deleteTeachingStudentApplyByStudentId(Long studentId)
    {
        return teachingStudentApplyMapper.deleteTeachingStudentApplyByStudentId(studentId);
    }

    /**
     * 根据课程id查询学生报课
     *
     * @param courseId 学生报课主键
     * @return 学生报课
     */
    @Override
    public List<TeachingStudentApply> selectTeachingStudentApplyByCourseId(Long courseId)
    {
        return teachingStudentApplyMapper.selectTeachingStudentApplyByCourseId(courseId);
    }
}
